Typically, a central processing unit (CPU, hereinafter also referred to as a processor) scheduler in a computer system is responsible for allocating CPU cycles to various tasks. The complexity of the CPU scheduler may increase on systems having more than one CPU. In such systems, the scheduler may need to manage tasks across multiple CPUs. An approach is to provide a global run queue. Each CPU may be configured to pull tasks from the global run queue when the CPU needs to schedule a task. A disadvantage of this approach is that requests from multiple CPUs may result in causing contention on the global run queue.
An alternative approach is to split the global run queue into several run queues, possibly one run queue for each CPU. Each CPU may refer to its own queue when it needs to schedule tasks. A disadvantage of this approach is the increased complexity for the scheduler to ensure that the tasks placed in the run queues are balanced, which may require the scheduler to periodically monitor the load on each run queue and relocate the tasks among the multiple run queues when necessary.
The inventors have recognized a need for an improved means of managing tasks in a computer system having a plurality of CPUs.